package com.code.leetcode.offer;

import java.util.Arrays;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/8/2 20:08
 */
public class The45_字符数组间的排序 {
    public String minNumber(int[] nums) {
        String[] strings = new String[nums.length];
        int index = 0;
        for (int num : nums) {
            strings[index++] = String.valueOf(num);
        }
        Arrays.sort(strings, (x, y)-> (x + y).compareTo(y + x));
        StringBuilder builder = new StringBuilder();
        for (String string : strings) {
            builder.append(string);
        }
        return builder.toString();
    }
}
